package com.logisticsrepair;

import com.logisticsrepair.entity.MaterialLibraryEntity;
import com.logisticsrepair.service.MaterialLibraryService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.ArrayList;

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class MaterialLibraryTest {

    @Autowired
    private MaterialLibraryService materialLibraryService;

    /**
     * 材料库数据
     */
    @Test
    public void test(){
        MaterialLibraryEntity m1 = new MaterialLibraryEntity(null, "节能灯", 21D, 100,null);
        MaterialLibraryEntity m2 = new MaterialLibraryEntity(null, "日光灯管", 20.4D, 100,null);
        MaterialLibraryEntity m3 = new MaterialLibraryEntity(null, "声控开关", 20D, 100,null);
        MaterialLibraryEntity m4 = new MaterialLibraryEntity(null, "自攻螺丝", 12.5D, 100,null);
        MaterialLibraryEntity m5 = new MaterialLibraryEntity(null, "绝缘胶布", 20D, 100,null);
        MaterialLibraryEntity m8 = new MaterialLibraryEntity(null, "防水胶带", 5.5D, 100,null);
        MaterialLibraryEntity m6 = new MaterialLibraryEntity(null, "明装开关", 18.5D, 100,null);
        MaterialLibraryEntity m7 = new MaterialLibraryEntity(null, "吊灯头", 20D, 100,null);
        MaterialLibraryEntity m9 = new MaterialLibraryEntity(null, "防水灯罩", 22.8D, 100,null);
        MaterialLibraryEntity m10 = new MaterialLibraryEntity(null, "明插座", 16.4D, 100,null);
        ArrayList<MaterialLibraryEntity> list = new ArrayList<>();
        list.add(m1);
        list.add(m2);
        list.add(m3);
        list.add(m4);
        list.add(m5);
        list.add(m6);
        list.add(m7);
        list.add(m8);
        list.add(m9);
        list.add(m10);
        boolean b = materialLibraryService.saveBatch(list);
        System.out.println(b);
    }
}
